package sk.fiit.vppj.eventmanager.core;

import javax.swing.JOptionPane;

/**
 * Helper class for showing errors to user through dialog boxes
 */
public final class ErrorHandler extends JOptionPane {
	private static ErrorHandler error = new ErrorHandler();
	
	private ErrorHandler() {
	}
	
	public static ErrorHandler getInstance()
	{
		return error;
	}
	
	/**
	 * Method for showing error message
	 * @param error message, which you want to show to user
	 */
	public void showErrorMessage( String message )
	{
		error.setMessageType( JOptionPane.ERROR_MESSAGE );
		error.setMessage( message );
		error.createDialog( getParent(), "Error" ).setVisible( true );
	}
}
